﻿using System.Collections.Generic;
using System.Data.SqlClient;

namespace Twipler.Data.Cache
{
	public class TableColumn
	{
		public string Name;
		public string SqlType;
		public string ParamName;
		public bool PrimaryKey;

		public TableColumn(bool primaryKey, string name, string sqlType, string paramName)
		{
			PrimaryKey = primaryKey;
			Name = name;
			SqlType = sqlType;
			ParamName = paramName;
		}

        public string EqualsParam
        {
            get
            {
                return Name + "=" + ParamName;
            }
        }
	}

	public interface IReadWriteTableStore
    {
        int ColumnCount { get; }
        List<TableColumn> Columns { get; }

		int TableNameParamCount { get; }
		string TableName { get;  }

        void FromSqlDataReader(SqlDataReader sqlReader);
        void AddParameters(SqlCommand command);

    	void QueryParams(SqlCommand command, params object[] args);
    }
}
